<?php

require_once "../../tfsbox_session.class.php";

class TFsBOX_PHPBB3_Session extends TFsBOXSession
	{
		private $auth;
		private $user;

		function __construct()
			{
				parent::__construct();
			}

		function format_date($date)
			{
				return $this->user->format_date($date);
			}

		function setAuthReference(&$auth)
			{
				$this->auth = $auth;
			}

		function loggedIn()
			{
				return $this->user->data['is_registered'];
			}

		function setUserReference(&$user)
			{
				$this->user = $user;
			}

		function startSession()
			{
				self::$user_name = $this->user->data['username'];

				// Check shout
				if ($this->isShoutValid($_POST['tfsbox_shout']))
					self::$user_shout = TFsBOX::filterShout($_POST['tfsbox_shout']);

				// Check user site
				if ($this->isUserSiteValid($this->user->data['user_website']))
					self::$user_site = $this->user->data['user_website'];
			}

		function userId()
			{
				return $this->user->data['user_id'];
			}

		function userRanking()
			{
				if ($this->auth->acl_get('a_') || ($this->user->data['user_type'] == USER_FOUNDER))
					return TFsBOXSession::ADMIN;
				else if ($this->auth->acl_get('m_'))
					return TFsBOXSession::MODERATOR;
				else
					return TFsBOXSession::REGULAR;
			}

		function userStyleId()
			{
				return (int) $this->user->data['user_style'];
			}

		function userStyleName()
			{
				return $this->user->theme['theme_name'];
			}
	}

?>
